﻿@namespace SwashbucklerDiary.Components
@inherits MyComponentBase

<div class="my-card-list">
    @foreach (var item in Value!)
    {
        <TagCard Value="item"
                 OnDelete="OpenDeleteDialog"
                 OnRename="OpenRenameDialog"
                 OnClick="HandleClick">
        </TagCard>
    }
</div>

@if (!Value.Any())
{
    <div class="my-not-have">
        <div class="text-h6 text--secondary font-weight-bold-desktop">
            @(I18n.T("Tag.NoTag"))
        </div>
    </div>
}

<InputDialog @bind-Value="ShowRename"
@bind-Text="SelectedTag.Name"
             Title="@(I18n.T("Tag.Rename"))"
             Placeholder="@(I18n.T("Tag.Placeholder"))"
             OnOK="HandleRename">
</InputDialog>

<DeleteDialog @bind-Value="ShowDelete"
              Title="@(I18n.T("Tag.Delete.Title"))"
              Content="@(I18n.T("Tag.Delete.Content"))"
              OnOK="()=>HandleDelete(SelectedTag)">
</DeleteDialog>
